package ysq.xyg.sys.model.po;

import lombok.Data;
import lombok.NoArgsConstructor;
import ysq.xyg.base.util.BaseConstant;
import ysq.xyg.base.util.BaseUtil;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;

/**
 * 系统管理-登录日志实体类
 *
 * @author shengQiang yu
 * @date 2019-3-28 16:42:01
 */
@Data
@NoArgsConstructor
@Table(name = "xyg_sys_log_login")
public class SysLogLogin implements Serializable{

	/**
     * 主键
     */ 
	@Id
	private String id;
	
	/**
     * 登录名称
     */ 
	@Column(name = "login_name")
	private String loginName;
	
	/**
     * 操作类别:1、其它，2、后台用户，3、手机端用户
     */ 
	@Column(name = "operator_type")
	private String operatorType;
	
	/**
     * 操作Ip地址
     */ 
	@Column(name = "oper_ip")
	private String operIp;
	
	/**
     * 操作状态：1、操作成功，2、操作失败
     */ 
	@Column(name = "oper_status")
	private String operStatus;
	
	/**
     * 错误消息
     */ 
	@Column(name = "error_msg")
	private String errorMsg;

	/**
     * 创建时间
     */ 
	@Column(name = "create_time")
	private Date createTime;


	public SysLogLogin(SysUser sysUser) {
		this.id= BaseUtil.uId();
		this.createTime = new Date();
	}

	public SysLogLogin(String loginName, String operIp) {
		this.id= BaseUtil.uId();
		this.createTime = new Date();
		this.loginName = loginName;
		this.operIp = operIp;
		this.operatorType= BaseConstant.SYS_OPERATOR_TYPE_PC;
	}
}